package com.dyz.controller;

import com.dyz.model.LoginUserResult;
import com.dyz.service.SysLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Api(tags = "登录的控制器")
public class SysLoginController {
    @Resource
    private SysLoginService sysLoginService;
    @PostMapping("/login")
    @ApiOperation(value = "后台管理人员的登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "username", value = "用户名", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "password", value = "密码", dataType = "String", paramType = "query")
    })
    public LoginUserResult login(
            @RequestParam (required = true) String username,//用户名
            @RequestParam (required = true) String password //密码
    ) {
        return  sysLoginService.login(username, password);
    }
}
